+function(){
  var deletedialog;
  $('body').on('click', '.summarydetail', function(event) {
    var that = $(this).parent();
    var content = '<div class="profile-user-info profile-user-info-striped">'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 下店天数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_inshop').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 出差天数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_outday').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 见终端客人 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_seeboss').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 成交终端客人 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_getboss').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 终端销售业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_tecount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 收款业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_skcount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 出货业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_outcount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 考核过关人数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_joinv').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 卖卡数量 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_sellcar').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 会议铺垫 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_meet').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '</div>';

    // var content = '<h4>下店天数:</h4><span>'+that.prevAll('.J_inshop').val()+'</span><br>'+
    //               '<h4>出差天数:</h4><span>'+that.prevAll('.J_outday').val()+'</span><br>'+
    //               '<h4>见终端客人:</h4><span>'+that.prevAll('.J_seeboss').val()+'</span><br>'+
    //               '<h4>成交终端客人:</h4><span>'+that.prevAll('.J_getboss').val()+'</span><br>'+
    //               '<h4>终端销售业绩:</h4><span>'+that.prevAll('.J_tecount').val()+'</span><br>'+
    //               '<h4>收款业绩:</h4><span>'+that.prevAll('.J_skcount').val()+'</span><br>'+
    //               '<h4>出货业绩:</h4><span>'+that.prevAll('.J_outcount').val()+'</span><br>'+
    //               '<h4>考核过关人数:</h4><span>'+that.prevAll('.J_joinv').val()+'</span><br>'+
    //               '<h4>卖卡数量:</h4><span>'+that.prevAll('.J_sellcar').val()+'</span><br>'+
    //               '<h4>会议铺垫:</h4><span>'+that.prevAll('.J_meet').val()+'</span><br>'+
    //               '';
    var t = dialog({
      title:'详情',
      content: content,
      width:'300px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal();
  });

  $('body').on('click', '.summarydetail_t2', function(event) {
    var that = $(this).parent();
    var content = '<div class="profile-user-info profile-user-info-striped">'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 下店天数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_inshop').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 出差天数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_outday').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 见终端客人 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_seeboss').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 成交终端客人 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_getboss').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 终端销售业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_tecount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 个人操作项目 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_singledo').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 个人消耗业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_singlefuck').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 收款业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_skcount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 出货业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_outcount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 考核过关人数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_joinv').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 卖卡数量 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_sellcar').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 会议铺垫 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_meet').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '</div>';

    var t = dialog({
      title:'详情',
      content: content,
      width:'300px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal();
  });

  $('body').on('click', '.summarydetail_t3', function(event) {
    var that = $(this).parent();
    var content = '<style>.profile-info-name{width:170px;}.profile-info-value{margin-left:170px;}</style>'+
                  '<div class="profile-user-info profile-user-info-striped">'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 出差天数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_outday').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 跑店天数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_runshop').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 会议场次 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_meetcount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 收集店面信息数量 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_shopinfocount').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 拜访店面数量 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_bfshop').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 有效店面数量 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_ysshop').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 有效工资 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_ysgz').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 成交店面数量 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_czshop').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 成交业绩 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_czyj').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 成交店名+品牌+款项名称 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_shopinfo').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '<div class="profile-info-row">'+
                  '<div class="profile-info-name"> 新老板娘和美容师总人数 </div>'+
                  '<div class="profile-info-value">'+
                  '<span class="editable">'+that.prevAll('.J_newboss').val()+'</span>'+
                  '</div>'+
                  '</div>'+
                  '</div>';

    var t = dialog({
      title:'详情',
      content: content,
      width:'500px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal();
  });
  $('body').on('click', '#summaryout', function() {
    window.brandcount = [];
    window.brandnamecount = [];
    window.emcount = [];
    window.emnamecount = [];
    var content = ''+
                  '<li>品牌：<span id="shopbrand" class="J_selectbranditem">未选择品牌</span><a href="javascript:;" style="line-height:27px;" class="selectbrand">选择品牌</a></li>'+
                  '<li>员工：<span id="semployee" class="J_selectemitem">未选择员工</span><a href="javascript:;" style="line-height:27px;" class="selectem">选择员工</a></li></li>'+
                  '<li>时间：<input id="stime" name="stime" type="text" class="Wdate" readonly>-<input id="otime" name="otime" type="text" class="Wdate" readonly></li>'+
                  '<li><button class="btn btn-success no-border btn-sm" id="summaryoutgo" style="width:100px;margin-left:153px;margin-top:22px;">导 出</button></li>'+
                  '';
    var t = dialog({
      title:'导出总结 - 市场人员行程',
      content: content,
      width:'400px',
      skin:'  dialog-box',
      lock:true,
      padding:'30px'
    }).showModal();
  });
  $('body').on('click', '#summaryout_t2', function() {
    window.brandcount = [];
    window.brandnamecount = [];
    window.emcount = [];
    window.emnamecount = [];
    var content = ''+
                  '<li>品牌：<span id="shopbrand" class="J_selectbranditem">未选择品牌</span><a href="javascript:;" style="line-height:27px;" class="selectbrand">选择品牌</a></li>'+
                  '<li>员工：<span id="semployee" class="J_selectemitem">未选择员工</span><a href="javascript:;" style="line-height:27px;" class="selectem">选择员工</a></li></li>'+
                  '<li>时间：<input id="stime" name="stime" type="text" class="Wdate" readonly>-<input id="otime" name="otime" type="text" class="Wdate" readonly></li>'+
                  '<li><button class="btn btn-success no-border btn-sm" id="summaryoutgo_t2" style="width:100px;margin-left:153px;margin-top:22px;">导 出</button></li>'+
                  '';
    var t = dialog({
      title:'导出总结 - 市场讲师监督表',
      content: content,
      width:'400px',
      skin:'  dialog-box',
      lock:true,
      padding:'30px'
    }).showModal();
  });
  $('body').on('click', '#summaryout_t3', function() {
    window.brandcount = [];
    window.brandnamecount = [];
    window.emcount = [];
    window.emnamecount = [];
    var content = ''+
                  '<li>员工：<span id="semployee" class="J_selectemitem">未选择员工</span><a href="javascript:;" style="line-height:27px;" class="selectem">选择员工</a></li></li>'+
                  '<li>时间：<input id="stime" name="stime" type="text" class="Wdate" readonly>-<input id="otime" name="otime" type="text" class="Wdate" readonly></li>'+
                  '<li><button class="btn btn-success no-border btn-sm" id="summaryoutgo_t3" style="width:100px;margin-left:153px;margin-top:22px;">导 出</button></li>'+
                  '';
    var t = dialog({
      title:'导出总结 - 拓展部考勤统计表',
      content: content,
      width:'400px',
      skin:'  dialog-box',
      lock:true,
      padding:'30px'
    }).showModal();
  });

  $('body').on('click', '#summaryoutgo', function() {
    var bid = '';
    for (var i = 0; i < window.brandcount.length; i++) {
      if(window.brandcount[i]){
        bid = bid+','+window.brandcount[i];
      }
    }
    bid = bid.replace(',','');
    var emid = '';
    for (var i = 0; i < window.emcount.length; i++) {
      if(window.emcount[i]){
        emid = emid+','+window.emcount[i];
      }
    }
    emid = emid.replace(',','');
    var postdata = {
      bid:bid,
      emid:emid,
      maxday:$('#otime').val(),
      minday:$('#stime').val()
    }
    window.location.href="/summary/summaryexcel?bid="+bid+"&emid="+emid+"&maxday="+$('#otime').val()+"&minday="+$('#stime').val();
  });
  $('body').on('click', '#summaryoutgo_t2', function() {
    var bid = '';
    for (var i = 0; i < window.brandcount.length; i++) {
      if(window.brandcount[i]){
        bid = bid+','+window.brandcount[i];
      }
    }
    bid = bid.replace(',','');
    var emid = '';
    for (var i = 0; i < window.emcount.length; i++) {
      if(window.emcount[i]){
        emid = emid+','+window.emcount[i];
      }
    }
    emid = emid.replace(',','');
    var postdata = {
      bid:bid,
      emid:emid,
      maxday:$('#otime').val(),
      minday:$('#stime').val()
    }
    window.location.href="/summary/summaryexcel_t2?bid="+bid+"&emid="+emid+"&maxday="+$('#otime').val()+"&minday="+$('#stime').val();
  });
  $('body').on('click', '#summaryoutgo_t3', function() {
    var emid = '';
    for (var i = 0; i < window.emcount.length; i++) {
      if(window.emcount[i]){
        emid = emid+','+window.emcount[i];
      }
    }
    emid = emid.replace(',','');
    var postdata = {
      emid:emid,
      maxday:$('#otime').val(),
      minday:$('#stime').val()
    }
    window.location.href="/summary/summaryexcel_t3?emid="+emid+"&maxday="+$('#otime').val()+"&minday="+$('#stime').val();
  });
  $('body').on('focus', '#stime', function() {
      WdatePicker({ skin: 'whyGreen', dateFmt: 'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'otime\');}' });
  });
  $('body').on('focus', '#otime', function() {
      WdatePicker({ skin: 'whyGreen', dateFmt: 'yyyy-MM-dd',minDate:'#F{$dp.$D(\'stime\');}' });
  });
  $('body').on('click', '.updatesummary_t1', function() {
    var content = ''+
      		'<div class="row table table-1">'+
      			'<div class="col-xs-12">'+
      				'<form class="form-horizontal" action="/shop/shop_add_go" method="post">'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="bid">员工</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="emid" id="t1-emid" name="emid" style="width:180px;">'+
                      '<option value="">选择员工</option>'+
                    '</select>'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="bid">品牌</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="bid" id="t1-bid" name="bid" style="width:180px;">'+
                      '<option value="">选择品牌</option>'+
                    '</select>'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="shopid">店铺</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="shopid" id="t1-shopid" name="shopid" style="width:180px;">'+
                      '<option value="0">选择店铺</option>'+
                    '</select>'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="content">工作内容(地名+行程主题+同行人)</label>'+
      						'<div class="col-sm-9">'+
      							'<input type="text" id="t1-content" class="col-sm-11" name="content">'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="inshop">下店天数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-inshop" class="col-sm-3" name="inshop">'+
      						  '<label class="col-sm-4 control-label no-padding-right" for="outday">出差天数</label>'+
      						  '<div class="col-sm-4">'+
      						  '<input type="text" id="t1-outday" class="col-sm-12" name="outday">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="seeboss">见终端客人/老板娘</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-seeboss" class="col-sm-3" name="seeboss">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="getboss">成交终端客人/老板娘</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t1-getboss" class="col-sm-12" name="getboss">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="tecount">终端销售业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-tecount" class="col-sm-3" name="tecount">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="skcount">收款业绩</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t1-skcount" class="col-sm-12" name="skcount">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="outcount">出货业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-outcount" class="col-sm-3" name="outcount">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="joinv">考核过关人数/加微信</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-joinv" class="col-sm-3" name="joinv">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="sellcar">卖卡数量/拜访数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t1-sellcar" class="col-sm-12" name="sellcar">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="meet">会议铺垫/收集资料</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-meet" class="col-sm-3" name="meet">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="pass">备注</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-pass" class="col-sm-3" name="pass">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<input type="button" class="btn btn-primary btn-lg" id="t1-summaryupdate" style="margin-left: 35%; margin-top:20px; display: block; padding-top: 3px; padding-bottom: 3px;" value="修  改">'+
      					'</div>'+
      				'</form>'+
      			'</div>'+
      		'</div>'+
                  '';
    var d = dialog({
      title:'修改总结',
      content: content,
      width:'600px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(viewinit());
    $.getJSON('/summary/getsummarybyid',{
      id:$(this).data('id')
    },function(data) {
      $('#t1-emid').val(parseInt(data.emid));
      $('#t1-bid').val(parseInt(data.bid));
      $('#t1-shopid').val(parseInt(data.shopid));
      $('#t1-content').val(data.content);
      $('#t1-inshop').val(data.inshop);
      $('#t1-outday').val(data.outday);
      $('#t1-seeboss').val(data.seeboss);
      $('#t1-getboss').val(data.getboss);
      $('#t1-tecount').val(data.tecount);
      $('#t1-skcount').val(data.skcount);
      $('#t1-outcount').val(data.outcount);
      $('#t1-joinv').val(data.joinv);
      $('#t1-sellcar').val(data.sellcar);
      $('#t1-meet').val(data.meet);
      $('#t1-pass').val(data.pass);
      $('#t1-summaryupdate').data('id',data.id);
    });
  });
  $('body').on('click', '#t1-summaryupdate', function() {
    var postdata = {
  				emid: $('#t1-emid').val(),
  				emid: $('#t1-emid').val(),
  				shopid: $('#t1-shopid').val(),
  				bid: $('#t1-bid').val(),
  				inshop: $('#t1-inshop').val(),
  				content: $('#t1-content').val(),
  				outday: $('#t1-outday').val(),
  				seeboss: $('#t1-seeboss').val(),
  				getboss: $('#t1-getboss').val(),
  				tecount: $('#t1-tecount').val(),
  				outcount: $('#t1-outcount').val(),
  				skcount: $('#t1-skcount').val(),
  				joinv: $('#t1-joinv').val(),
  				sellcar: $('#t1-sellcar').val(),
  				meet: $('#t1-meet').val(),
  				id: $(this).data('id'),
          pass: $('#t1-pass').val()
    }
		$.post('/summary/summaryupdate_t1',postdata, function(data) {
			if(data!='false'){
				alert('修改成功');
			}else {
				alert('修改失败');
			}
      location.reload(true);
		});
  });
  $('body').on('click', '.deletesummary_t1', function() {
    var content = '<span style="color:#d00">确定要删除这一条回访记录吗？</span>'+
                '<div class="dialog-button"><button class="btn btn-sm btn-primary" id="summaryDeletet_t1" value="'+$(this).data('id')+'">确定</button><button style="margin-left:30px;" class="btn btn-sm btn-primary" id="closeDelete">取消</button></div>';
      deletedialog = dialog({
        title:'温馨提示',
        content: content,
        width:'300px',
        skin:'  dialog-box',
        lock:true,
        padding:'10px'
      }).showModal();
  });
  $('body').on('click', '#summaryDeletet_t1', function() {
    $.get('/summary/summarydelete_t1', {
  		id: $(this).val()
    }, function(data) {
        alert(data);
       location.reload(true);
    });
  });

  $('body').on('click', '.updatesummary_t2', function() {
    var content = ''+
      		'<div class="row table table-2">'+
      			'<div class="col-xs-12">'+
      				'<form class="form-horizontal" action="/shop/shop_add_go" method="post">'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="bid">员工</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="emid" id="t2-emid" name="emid" style="width:180px;">'+
                      '<option value="">选择员工</option>'+
                    '</select>'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="bid">品牌</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="bid" id="t2-bid" name="bid" style="width:180px;">'+
                      '<option value="">选择品牌</option>'+
                    '</select>'+
      						'</div>'+
      					'</div>'+
      					'<!-- <div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="shopid">店铺</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="shopid" id="t2-shopid" name="shopid" style="width:180px;">'+
                      '<option value="0">选择店铺</option>'+
                    '</select>'+
      						'</div>'+
      					'</div> -->'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="content">工作内容/考核内容</label>'+
      						'<div class="col-sm-9">'+
      							'<input type="text" id="t2-content" class="col-xs-10 col-sm-10" name="content">'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="inshop">下店天数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-inshop" class="col-xs-10 col-sm-3" name="inshop">'+
      						  '<label class="col-sm-4 control-label no-padding-right" for="outday">出差天数</label>'+
      						  '<div class="col-sm-4">'+
      						  '<input type="text" id="t2-outday" class="col-xs-10 col-sm-12" name="outday">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="seeboss">见终端客人/老板娘</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-seeboss" class="col-xs-10 col-sm-3" name="seeboss">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="getboss">成交终端客人/老板娘</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t2-getboss" class="col-xs-10 col-sm-12" name="getboss">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="tecount">终端销售业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-tecount" class="col-xs-10 col-sm-3" name="tecount">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="skcount">收款业绩</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t2-skcount" class="col-xs-10 col-sm-12" name="skcount">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="outcount">出货业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-outcount" class="col-xs-10 col-sm-3" name="outcount">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="singledo">个人操作项目</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-singledo" class="col-xs-10 col-sm-3" name="singledo">'+
        						'<label class="col-sm-4 control-label no-padding-right" for="singlefuck">个人消耗业绩</label>'+
        						'<div class="col-sm-4">'+
        						  '<input type="text" id="t2-singlefuck" class="col-xs-10 col-sm-12" name="singlefuck">'+
                    '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="joinv">考核过关人数/加微信</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-joinv" class="col-xs-10 col-sm-3" name="joinv">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="sellcar">卖卡数量/拜访数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t2-sellcar" class="col-xs-10 col-sm-12" name="sellcar">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="meet">会议铺垫/收集资料</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-meet" class="col-xs-10 col-sm-3" name="meet">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="pass">备注</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-pass" class="col-xs-10 col-sm-10" name="pass">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<input type="button" class="btn btn-primary btn-lg" id="t2-summaryupdate" style="margin-left: 35%; margin-top:20px; display: block; padding-top: 3px; padding-bottom: 3px;" value="修  改">'+
      					'</div>'+
      				'</form>'+
      			'</div>'+
      		'</div>'+
                  '';
    var d = dialog({
      title:'修改总结',
      content: content,
      width:'600px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(viewinit());
    $.getJSON('/summary/getsummarybyid_t2',{
      id:$(this).data('id')
    },function(data) {
      $('#t2-emid').val(parseInt(data.emid));
      $('#t2-bid').val(parseInt(data.bid));
      $('#t2-content').val(data.content);
      $('#t2-inshop').val(data.inshop);
      $('#t2-outday').val(data.outday);
      $('#t2-seeboss').val(data.seeboss);
      $('#t2-getboss').val(data.getboss);
      $('#t2-tecount').val(data.tecount);
      $('#t2-skcount').val(data.skcount);
      $('#t2-outcount').val(data.outcount);
      $('#t2-singledo').val(data.singledo);
      $('#t2-singlefuck').val(data.singlefuck);
      $('#t2-joinv').val(data.joinv);
      $('#t2-sellcar').val(data.sellcar);
      $('#t2-meet').val(data.meet);
      $('#t2-pass').val(data.pass);
      $('#t2-summaryupdate').data('id',data.id);
    });
  });
  $('body').on('click', '#t2-summaryupdate', function() {
    var postdata = {
  				emid: $('#t2-emid').val(),
  				shopid: $('#t2-shopid').val(),
  				bid: $('#t2-bid').val(),
  				inshop: $('#t2-inshop').val(),
  				content: $('#t2-content').val(),
  				outday: $('#t2-outday').val(),
  				seeboss: $('#t2-seeboss').val(),
  				getboss: $('#t2-getboss').val(),
  				tecount: $('#t2-tecount').val(),
  				skcount: $('#t2-skcount').val(),
  				outcount: $('#t2-outcount').val(),
  				singledo: $('#t2-singledo').val(),
  				singlefuck: $('#t2-singlefuck').val(),
  				joinv: $('#t2-joinv').val(),
  				sellcar: $('#t2-sellcar').val(),
  				meet: $('#t2-meet').val(),
  				id: $(this).data('id'),
          pass: $('#t2-pass').val()
    }
		$.post('/summary/summaryupdate_t2',postdata, function(data) {
			if(data!='false'){
				alert('修改成功');
			}else {
				alert('修改失败');
			}
      location.reload(true);
		});
  });
  $('body').on('click', '.deletesummary_t2', function() {
    var content = '<span style="color:#d00">确定要删除这一条回访记录吗？</span>'+
                '<div class="dialog-button"><button class="btn btn-sm btn-primary" id="summaryDeletet_t2" value="'+$(this).data('id')+'">确定</button><button style="margin-left:30px;" class="btn btn-sm btn-primary" id="closeDelete">取消</button></div>';
      deletedialog = dialog({
        title:'温馨提示',
        content: content,
        width:'300px',
        skin:'  dialog-box',
        lock:true,
        padding:'10px'
      }).showModal();
  });
  $('body').on('click', '#summaryDeletet_t2', function() {
    $.get('/summary/summarydelete_t2', {
  		id: $(this).val()
    }, function(data) {
      alert(data);
      location.reload(true);
    });
  });

  $('body').on('click', '.updatesummary_t3', function() {
    var content = ''+
      		'<div class="row table table-3">'+
      			'<div class="col-xs-12">'+
      				'<form class="form-horizontal" action="/shop/shop_add_go" method="post">'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="bid">员工</label>'+
      						'<div class="col-sm-9">'+
                    '<select class="emid" id="t3-emid" name="emid" style="width:180px;">'+
                      '<option value="">选择员工</option>'+
                    '</select>'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="content">行程内容</label>'+
      						'<div class="col-sm-9">'+
      							'<input type="text" id="t3-content" class="col-xs-10 col-sm-10" name="content">'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="zone">区域</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-zone" class="col-xs-10 col-sm-3" name="zone">'+
      						  '<label class="col-sm-4 control-label no-padding-right" for="outday">出差天数</label>'+
      						  '<div class="col-sm-4">'+
      						  '<input type="text" id="t3-outday" class="col-xs-10 col-sm-12" name="outday">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="runshop">跑店天数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-runshop" class="col-xs-10 col-sm-3" name="runshop">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="meetcount">会议场次</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t3-meetcount" class="col-xs-10 col-sm-12" name="meetcount">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="shopinfocount">收集店面信息数量</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-shopinfocount" class="col-xs-10 col-sm-3" name="shopinfocount">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="bfshop">拜访店面数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t3-bfshop" class="col-xs-10 col-sm-12" name="bfshop">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="ysshop">有效店面</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-ysshop" class="col-xs-10 col-sm-3" name="ysshop">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="ysgz">有效工资(有效拜访达6家)</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-ysgz" class="col-xs-10 col-sm-3" name="ysgz">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="czshop">成交点面数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t3-czshop" class="col-xs-10 col-sm-12" name="czshop">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="czyj">成交业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-czyj" class="col-xs-10 col-sm-3" name="czyj">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="shopinfo">成交店名+品牌+款项名称</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-shopinfo" class="col-xs-10 col-sm-10" name="shopinfo">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="newboss">新店老板娘和美容师总人数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-newboss" class="col-xs-10 col-sm-3" name="newboss">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<input type="button" class="btn btn-primary btn-lg" id="t3-summaryupdate" style="margin-left: 35%; margin-top:20px; display: block; padding-top: 3px; padding-bottom: 3px;" value="修  改">'+
      					'</div>'+
      				'</form>'+
      			'</div>'+
      		'</div>'+
                  '';
    var d = dialog({
      title:'修改总结',
      content: content,
      width:'600px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(viewinit());
    $.getJSON('/summary/getsummarybyid_t3',{
      id:$(this).data('id')
    },function(data) {
      $('#t3-emid').val(parseInt(data.emid));
      $('#t3-content').val(data.content);
      $('#t3-zone').val(data.zone);
      $('#t3-outday').val(data.outday);
      $('#t3-runshop').val(data.runshop);
      $('#t3-meetcount').val(data.meetcount);
      $('#t3-shopinfocount').val(data.shopinfocount);
      $('#t3-bfshop').val(data.bfshop);
      $('#t3-ysshop').val(data.ysshop);
      $('#t3-ysgz').val(data.ysgz);
      $('#t3-czshop').val(data.czshop);
      $('#t3-czyj').val(data.czyj);
      $('#t3-shopinfo').val(data.shopinfo);
      $('#t3-newboss').val(data.newboss);
      $('#t3-summaryupdate').data('id',data.id);
    });
  });
  $('body').on('click', '#t3-summaryupdate', function() {
    var postdata = {
  				emid: $('#t3-emid').val(),
  				content: $('#t3-content').val(),
  				zone: $('#t3-zone').val(),
  				outday: $('#t3-outday').val(),
  				runshop: $('#t3-runshop').val(),
  				meetcount: $('#t3-meetcount').val(),
  				shopinfocount: $('#t3-shopinfocount').val(),
  				bfshop: $('#t3-bfshop').val(),
  				ysshop: $('#t3-ysshop').val(),
  				ysgz: $('#t3-ysgz').val(),
  				czshop: $('#t3-czshop').val(),
  				czyj: $('#t3-czyj').val(),
  				shopinfo: $('#t3-shopinfo').val(),
  				newboss: $('#t3-newboss').val(),
  				id: $(this).data('id')
    }
		$.post('/summary/summaryupdate_t3',postdata, function(data) {
			if(data!='false'){
				alert('修改成功');
			}else {
				alert('修改失败');
			}
      location.reload(true);
		});
  });
  $('body').on('click', '.deletesummary_t3', function() {
    var content = '<span style="color:#d00">确定要删除这一条回访记录吗？</span>'+
                '<div class="dialog-button"><button class="btn btn-sm btn-primary" id="summaryDeletet_t3" value="'+$(this).data('id')+'">确定</button><button style="margin-left:30px;" class="btn btn-sm btn-primary" id="closeDelete">取消</button></div>';
      deletedialog = dialog({
        title:'温馨提示',
        content: content,
        width:'300px',
        skin:'  dialog-box',
        lock:true,
        padding:'10px'
      }).showModal();
  });
  $('body').on('click', '#summaryDeletet_t3', function() {
    $.get('/summary/summarydelete_t3', {
  		id: $(this).val()
    }, function(data) {
      alert(data);
      location.reload(true);
    });
  });

  $('body').on('click', '.my_updatesummary_t1', function() {
    var content = ''+
      		'<div class="row table table-1">'+
      			'<div class="col-xs-12">'+
      				'<form class="form-horizontal" action="/shop/shop_add_go" method="post">'+
                '<input type="hidden" id="t1_emid" name="emid">'+
                '<input type="hidden" id="t1_bid" name="bid">'+
                '<input type="hidden" id="t1_shopid" name="shopid">'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="content">工作内容(地名+行程主题+同行人)</label>'+
      						'<div class="col-sm-9">'+
      							'<input type="text" id="t1-content" class="col-sm-11" name="content">'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="inshop">下店天数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-inshop" class="col-sm-3" name="inshop">'+
      						  '<label class="col-sm-4 control-label no-padding-right" for="outday">出差天数</label>'+
      						  '<div class="col-sm-4">'+
      						  '<input type="text" id="t1-outday" class="col-sm-12" name="outday">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="seeboss">见终端客人/老板娘</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-seeboss" class="col-sm-3" name="seeboss">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="getboss">成交终端客人/老板娘</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t1-getboss" class="col-sm-12" name="getboss">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="tecount">终端销售业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-tecount" class="col-sm-3" name="tecount">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="skcount">收款业绩</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t1-skcount" class="col-sm-12" name="skcount">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="outcount">出货业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-outcount" class="col-sm-3" name="outcount">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="joinv">考核过关人数/加微信</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-joinv" class="col-sm-3" name="joinv">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="sellcar">卖卡数量/拜访数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t1-sellcar" class="col-sm-12" name="sellcar">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="meet">会议铺垫/收集资料</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-meet" class="col-sm-3" name="meet">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="pass">备注</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t1-pass" class="col-sm-3" name="pass">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<input type="button" class="btn btn-primary btn-lg" id="my_t1-summaryupdate" style="margin-left: 35%; margin-top:20px; display: block; padding-top: 3px; padding-bottom: 3px;" value="修  改">'+
      					'</div>'+
      				'</form>'+
      			'</div>'+
      		'</div>'+
                  '';
    var d = dialog({
      title:'修改总结',
      content: content,
      width:'600px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(viewinit());
    $.getJSON('/summary/getsummarybyid',{
      id:$(this).data('id')
    },function(data) {
      $('#t1-emid').val(parseInt(data.emid));
      $('#t1-bid').val(parseInt(data.bid));
      $('#t1-shopid').val(parseInt(data.shopid));
      $('#t1-content').val(data.content);
      $('#t1-inshop').val(data.inshop);
      $('#t1-outday').val(data.outday);
      $('#t1-seeboss').val(data.seeboss);
      $('#t1-getboss').val(data.getboss);
      $('#t1-tecount').val(data.tecount);
      $('#t1-skcount').val(data.skcount);
      $('#t1-outcount').val(data.outcount);
      $('#t1-joinv').val(data.joinv);
      $('#t1-sellcar').val(data.sellcar);
      $('#t1-meet').val(data.meet);
      $('#t1-pass').val(data.pass);
      $('#t1-summaryupdate').data('id',data.id);
    });
  });
  $('body').on('click', '#my_t1-summaryupdate', function() {
    var postdata = {
  				emid: $('#t1-emid').val(),
  				emid: $('#t1-emid').val(),
  				shopid: $('#t1-shopid').val(),
  				bid: $('#t1-bid').val(),
  				inshop: $('#t1-inshop').val(),
  				content: $('#t1-content').val(),
  				outday: $('#t1-outday').val(),
  				seeboss: $('#t1-seeboss').val(),
  				getboss: $('#t1-getboss').val(),
  				tecount: $('#t1-tecount').val(),
  				outcount: $('#t1-outcount').val(),
  				skcount: $('#t1-skcount').val(),
  				joinv: $('#t1-joinv').val(),
  				sellcar: $('#t1-sellcar').val(),
  				meet: $('#t1-meet').val(),
  				id: $(this).data('id'),
          pass: $('#t1-pass').val()
    }
		$.post('/summary/summaryupdate_t1',postdata, function(data) {
			if(data!='false'){
				alert('修改成功');
			}else {
				alert('修改失败');
			}
      location.reload(true);
		});
  });
  $('body').on('click', '.my_updatesummary_t2', function() {
    var content = ''+
      		'<div class="row table table-2">'+
      			'<div class="col-xs-12">'+
      				'<form class="form-horizontal" action="/shop/shop_add_go" method="post">'+
                '<input type="hidden" id="t2-emid" name="emid">'+
                '<input type="hidden" id="t2-bid" name="bid">'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="content">工作内容/考核内容</label>'+
      						'<div class="col-sm-9">'+
      							'<input type="text" id="t2-content" class="col-xs-10 col-sm-10" name="content">'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="inshop">下店天数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-inshop" class="col-xs-10 col-sm-3" name="inshop">'+
      						  '<label class="col-sm-4 control-label no-padding-right" for="outday">出差天数</label>'+
      						  '<div class="col-sm-4">'+
      						  '<input type="text" id="t2-outday" class="col-xs-10 col-sm-12" name="outday">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="seeboss">见终端客人/老板娘</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-seeboss" class="col-xs-10 col-sm-3" name="seeboss">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="getboss">成交终端客人/老板娘</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t2-getboss" class="col-xs-10 col-sm-12" name="getboss">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="tecount">终端销售业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-tecount" class="col-xs-10 col-sm-3" name="tecount">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="skcount">收款业绩</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t2-skcount" class="col-xs-10 col-sm-12" name="skcount">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="outcount">出货业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-outcount" class="col-xs-10 col-sm-3" name="outcount">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="singledo">个人操作项目</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-singledo" class="col-xs-10 col-sm-3" name="singledo">'+
        						'<label class="col-sm-4 control-label no-padding-right" for="singlefuck">个人消耗业绩</label>'+
        						'<div class="col-sm-4">'+
        						  '<input type="text" id="t2-singlefuck" class="col-xs-10 col-sm-12" name="singlefuck">'+
                    '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="joinv">考核过关人数/加微信</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-joinv" class="col-xs-10 col-sm-3" name="joinv">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="sellcar">卖卡数量/拜访数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t2-sellcar" class="col-xs-10 col-sm-12" name="sellcar">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="meet">会议铺垫/收集资料</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-meet" class="col-xs-10 col-sm-3" name="meet">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="pass">备注</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t2-pass" class="col-xs-10 col-sm-10" name="pass">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<input type="button" class="btn btn-primary btn-lg" id="t2-summaryupdate" style="margin-left: 35%; margin-top:20px; display: block; padding-top: 3px; padding-bottom: 3px;" value="修  改">'+
      					'</div>'+
      				'</form>'+
      			'</div>'+
      		'</div>'+
                  '';
    var d = dialog({
      title:'修改总结',
      content: content,
      width:'600px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(viewinit());
    $.getJSON('/summary/getsummarybyid_t2',{
      id:$(this).data('id')
    },function(data) {
      $('#t2-emid').val(parseInt(data.emid));
      $('#t2-bid').val(parseInt(data.bid));
      $('#t2-content').val(data.content);
      $('#t2-inshop').val(data.inshop);
      $('#t2-outday').val(data.outday);
      $('#t2-seeboss').val(data.seeboss);
      $('#t2-getboss').val(data.getboss);
      $('#t2-tecount').val(data.tecount);
      $('#t2-skcount').val(data.skcount);
      $('#t2-outcount').val(data.outcount);
      $('#t2-singledo').val(data.singledo);
      $('#t2-singlefuck').val(data.singlefuck);
      $('#t2-joinv').val(data.joinv);
      $('#t2-sellcar').val(data.sellcar);
      $('#t2-meet').val(data.meet);
      $('#t2-pass').val(data.pass);
      $('#t2-summaryupdate').data('id',data.id);
    });
  });
  $('body').on('click', '#my_t2-summaryupdate', function() {
    var postdata = {
  				emid: $('#t2-emid').val(),
  				shopid: $('#t2-shopid').val(),
  				bid: $('#t2-bid').val(),
  				inshop: $('#t2-inshop').val(),
  				content: $('#t2-content').val(),
  				outday: $('#t2-outday').val(),
  				seeboss: $('#t2-seeboss').val(),
  				getboss: $('#t2-getboss').val(),
  				tecount: $('#t2-tecount').val(),
  				skcount: $('#t2-skcount').val(),
  				outcount: $('#t2-outcount').val(),
  				singledo: $('#t2-singledo').val(),
  				singlefuck: $('#t2-singlefuck').val(),
  				joinv: $('#t2-joinv').val(),
  				sellcar: $('#t2-sellcar').val(),
  				meet: $('#t2-meet').val(),
  				id: $(this).data('id'),
          pass: $('#t2-pass').val()
    }
		$.post('/summary/summaryupdate_t2',postdata, function(data) {
			if(data!='false'){
				alert('修改成功');
			}else {
				alert('修改失败');
			}
      location.reload(true);
		});
  });
  $('body').on('click', '.my_updatesummary_t3', function() {
    var content = ''+
      		'<div class="row table table-3">'+
      			'<div class="col-xs-12">'+
      				'<form class="form-horizontal" action="/shop/shop_add_go" method="post">'+
                '<input type="hidden" id="t3_emid" name="emid">'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="content">行程内容</label>'+
      						'<div class="col-sm-9">'+
      							'<input type="text" id="t3-content" class="col-xs-10 col-sm-10" name="content">'+
      						'</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="zone">区域</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-zone" class="col-xs-10 col-sm-3" name="zone">'+
      						  '<label class="col-sm-4 control-label no-padding-right" for="outday">出差天数</label>'+
      						  '<div class="col-sm-4">'+
      						  '<input type="text" id="t3-outday" class="col-xs-10 col-sm-12" name="outday">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="runshop">跑店天数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-runshop" class="col-xs-10 col-sm-3" name="runshop">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="meetcount">会议场次</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t3-meetcount" class="col-xs-10 col-sm-12" name="meetcount">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="shopinfocount">收集店面信息数量</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-shopinfocount" class="col-xs-10 col-sm-3" name="shopinfocount">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="bfshop">拜访店面数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t3-bfshop" class="col-xs-10 col-sm-12" name="bfshop">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="ysshop">有效店面</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-ysshop" class="col-xs-10 col-sm-3" name="ysshop">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="ysgz">有效工资(有效拜访达6家)</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-ysgz" class="col-xs-10 col-sm-3" name="ysgz">'+
      						'<label class="col-sm-4 control-label no-padding-right" for="czshop">成交点面数量</label>'+
      						'<div class="col-sm-4">'+
      						  '<input type="text" id="t3-czshop" class="col-xs-10 col-sm-12" name="czshop">'+
                  '</div>'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="czyj">成交业绩</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-czyj" class="col-xs-10 col-sm-3" name="czyj">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="shopinfo">成交店名+品牌+款项名称</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-shopinfo" class="col-xs-10 col-sm-10" name="shopinfo">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<label class="col-sm-3 control-label no-padding-right" for="newboss">新店老板娘和美容师总人数</label>'+
      						'<div class="col-sm-9">'+
      						  '<input type="text" id="t3-newboss" class="col-xs-10 col-sm-3" name="newboss">'+
                  '</div>'+
      					'</div>'+
      					'<div class="form-group">'+
      						'<input type="button" class="btn btn-primary btn-lg" id="my_t3-summaryupdate" style="margin-left: 35%; margin-top:20px; display: block; padding-top: 3px; padding-bottom: 3px;" value="修  改">'+
      					'</div>'+
      				'</form>'+
      			'</div>'+
      		'</div>'+
                  '';
    var d = dialog({
      title:'修改总结',
      content: content,
      width:'600px',
      skin:'  dialog-box',
      lock:true,
      padding:'10px'
    }).showModal(viewinit());
    $.getJSON('/summary/getsummarybyid_t3',{
      id:$(this).data('id')
    },function(data) {
      $('#t3-emid').val(parseInt(data.emid));
      $('#t3-content').val(data.content);
      $('#t3-zone').val(data.zone);
      $('#t3-outday').val(data.outday);
      $('#t3-runshop').val(data.runshop);
      $('#t3-meetcount').val(data.meetcount);
      $('#t3-shopinfocount').val(data.shopinfocount);
      $('#t3-bfshop').val(data.bfshop);
      $('#t3-ysshop').val(data.ysshop);
      $('#t3-ysgz').val(data.ysgz);
      $('#t3-czshop').val(data.czshop);
      $('#t3-czyj').val(data.czyj);
      $('#t3-shopinfo').val(data.shopinfo);
      $('#t3-newboss').val(data.newboss);
      $('#t3-summaryupdate').data('id',data.id);
    });
  });
  $('body').on('click', '#my_t3-summaryupdate', function() {
    var postdata = {
  				emid: $('#t3-emid').val(),
  				content: $('#t3-content').val(),
  				zone: $('#t3-zone').val(),
  				outday: $('#t3-outday').val(),
  				runshop: $('#t3-runshop').val(),
  				meetcount: $('#t3-meetcount').val(),
  				shopinfocount: $('#t3-shopinfocount').val(),
  				bfshop: $('#t3-bfshop').val(),
  				ysshop: $('#t3-ysshop').val(),
  				ysgz: $('#t3-ysgz').val(),
  				czshop: $('#t3-czshop').val(),
  				czyj: $('#t3-czyj').val(),
  				shopinfo: $('#t3-shopinfo').val(),
  				newboss: $('#t3-newboss').val(),
  				id: $(this).data('id')
    }
		$.post('/summary/summaryupdate_t3',postdata, function(data) {
			if(data!='false'){
				alert('修改成功');
			}else {
				alert('修改失败');
			}
      location.reload(true);
		});
  });

  $('body').on('click', '#closeDelete', function() {
     deletedialog.close();
   });
  function viewinit(){
    $.get('/shop/getallshopselect', function(data) {
      var json = JSON.parse(data);
      var $shop = $('.shopid');
      for (var i = 0; i < json.length; i++) {
        if(json[i].shopid!=0){
          $shop.append('<option value="'+json[i].shopid+'">'+json[i].shopname+'</option>')
        }
      }
    });
    $.get('/brand/getallbrandselect', function(data) {
      var json = JSON.parse(data);
      var $brand = $('.bid');
      for (var i = 0; i < json.length; i++) {
        $brand.append('<option value="'+json[i].bid+'">'+json[i].bname+'</option>')
      }
    });
    $.get('/employee/getallemployeeselect', function(data) {
      var json = JSON.parse(data);
      var $emid = $('.emid');
      for (var i = 0; i < json.length; i++) {
        $emid.append('<option value="'+json[i].emid+'">'+json[i].emname+'</option>')
      }
    });
  }
  if(GetQueryString('search')!=null){
    $('.J_pinkey').each(function(index, el) {
      $(this).attr('href', $(this).attr('href')+'?search='+GetQueryString('search'));
    });
  }
  function GetQueryString(name){
       var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
       var r = window.location.search.substr(1).match(reg);
       if(r!=null)return  unescape(r[2]); return null;
  }      var key = window.location.href.split('?');
}(jQuery);
